#include "../Model/ssm.h"
#include <stdio.h>

int main()
{

	Dynamic source, dest;

	source.D_a		= .534;
	source.P_a		= .654;
	source.E_a		= 5.342;
	source.D_rr		= 6354.134;
	source.P_rr		= 1.54;
	source.E_rr		= 12.32;
	source.B_charge		= 42.12;
	source.P_array		= 343.12;
	source.E_array		= 1243.12;
	source.P_p		= 67.543;
	source.E_p		= 34.23;
	source.E_charge		= 1.123;
	source.F_g		= 67.12;
	source.P_g		= 9.45;
	source.E_g		= 52.324;
	source.P[3]		= 39.54;
	source.D[3]		= 23.45;
	source.distance		= 1549.34;
	source.speed		= 25.47;
	source.a		= 1.94;
	source.latitude		= 17.35;
	source.longitude	= 49.12;
	source.h		= 4.74;

	writeDynamic("testDynamic.dat",&source);
	
	readDynamic("testDynamic.dat",&dest);

	if(dest.D_a			== .534 &&
		dest.P_a		== .654 &&
		dest.E_a		== 5.342 &&
		dest.D_rr		== 6354.134 &&
		dest.P_rr		== 1.54 &&
		dest.E_rr		== 12.32 &&
		dest.B_charge		== 42.12 &&
		dest.P_array		== 343.12 &&
		dest.E_array		== 1243.12 &&
		dest.P_p		== 67.543 &&
		dest.E_p		== 34.23 &&
		dest.E_charge		== 1.123 &&
		dest.F_g		== 67.12 &&
		dest.P_g		== 9.45 &&
		dest.E_g		== 52.324 &&
		dest.P[3]		== 39.54 &&
		dest.D[3]		== 23.45 &&
		dest.distance		== 1549.34 &&
		dest.speed		== 25.47 &&
		dest.a		== 1.94 &&
		dest.latitude		== 17.35 &&
		dest.longitude	== 49.12 &&
		dest.h		== 4.74 )
	{		
		return 0;
	}
	else
	{
		fprintf(stderr,"ERROR:readDyanic does not equal writeDynamic\n");
		return -1;
	}	
}
